//Practical3D
//Lesson 1. Drawing

/**
Draw indexed quad
Connect four points using indexed geometry
*/
virtual void render()
{
	renderer->clear();
	vec3 points[4] = { vec3(0,0,0),vec3(0,1,0),vec3(1,1,0),vec3(1,0,0) };
	ushort indices[6] = { 0, 1, 2, 3, 2, 0 };
	renderer->bindCoords(points);
	renderer->draw(Renderer::Triangles, 6, indices);
}

/**
Draw indexed sphere
*/
vec3* vertices;
int numVertices;
ushort* indices;
int numIndices;

NativeApp()
{
	//compute the amount of points needed
	
	//fill the points of the sphere in polar coordinates
	
	//fill the indices for all triangles in the sphere
	
}

virtual void render()
{
	renderer->clear();
	renderer->bindCoords(vertices);
	renderer->draw(Renderer::Triangles, numIndices, indices);
}

/**
Culling
Draw the same indexed quad using or not backface culling
*/
virtual void render()
{
	renderer->clear();
	vec3 points[4] = { vec3(0,0,0),vec3(0,1,0),vec3(1,1,0),vec3(1,0,0) };
	ushort indices[6] = { 0, 1, 2, 3, 2, 0 };
	renderer->bindCoords(points);
	renderer->setCulling(true);
	renderer->draw(Renderer::Triangles, 6, indices);
}

/**
Culling
Draw indexed cylinder using backface culling
*/
vec3* vertices;
int numVertices;
NativeApp::NativeApp()
{
	//TODO- create geometry for cylinder
}
virtual void render()
{
	renderer->clear();
	
	//declare the geometry
	vec3 points[4] = { vec3(0,0,0),vec3(0,1,0),vec3(1,1,0),vec3(1,0,0) };
	ushort indices[6] = { 0, 1, 2, 3, 2, 0 };
	renderer->bindCoords(points);
	
	renderer->setCulling(Culling_None);
	renderer->draw(Renderer::Triangles, 6, indices);
	
	renderer->setCulling(Culling_CCW);
	renderer->draw(Renderer::Triangles, 6, indices);
}

/**
Culling
Draw a cube with faces looking inside
*/
virtual void render()
{
	renderer->clear();
	vec3 points[4] = { vec3(0,0,0),vec3(0,1,0),vec3(1,1,0),vec3(1,0,0), ... };
	ushort indices[6] = { 0, 1, 2, 3, 2, 0 }; // faces defined so that they look inside CCW
	//...
}

/**
Fillmode
*/
virtual void render()
{

}
